﻿@model ClothingDemo.Model.ProductTypeModel
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>TypeEditView</title>
    <script src="~/Scripts/jquery-3.5.1.js"></script>
    <link href="~/Scripts/layui/css/layui.css" rel="stylesheet" />
    <script src="~/Scripts/layui/layui.js"></script>
    <script src="~/Scripts/jquery.validate.unobtrusive.js"></script>
    <script src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
    <script src="~/Scripts/jquery.validate.js"></script>
</head>
<body>
    <div>
        @using (Ajax.BeginForm("TypeEdit", "ProductType", new AjaxOptions { OnSuccess = "addComp" }))
        {
            @Html.HiddenFor(m => m.id)
            @Html.HiddenFor(m => m.orderBy)
            <div class="layui-form-item">
                @Html.Label("商品类型")
                @Html.EditorFor(m => m.supClassName)
                @Html.ValidationMessageFor(m => m.supClassName)
            </div>
            <div class="layui-form-item">
                @Html.Label("类型层级")
                @Html.EditorFor(m => m.tier)
                @Html.ValidationMessageFor(m => m.tier)
            </div>
            <button>提交</button>
        }
        <script>
            function addComp(re){
                if (re.success){
                    parent.layer.msg(re.msg);
                    parent.layui.$("#btnSearch").click();
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index); //再执行关闭
                }else {
                    alert(re.msg);
                }
            }
        </script>
    </div>
</body>
</html>
